/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('tingwu', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateFileTransRequest {
  abilityParams?: map[string]any(name='AbilityParams'),
  appKey?: string(name='AppKey', example='JV1sRTisRMi****'),
  asrParams?: map[string]any(name='AsrParams'),
  audioLanguage?: string(name='AudioLanguage', example='cn'),
  audioOssBucket?: string(name='AudioOssBucket', example='bucket'),
  audioOssPath?: string(name='AudioOssPath', example='dir1/dir2/filename'),
  audioOutputEnabled?: boolean(name='AudioOutputEnabled', example='false'),
  audioOutputOssBucket?: string(name='AudioOutputOssBucket', example='bucket'),
  audioOutputOssPath?: string(name='AudioOutputOssPath', example='tingwu/dir/filename'),
  audioRoleNum?: string(name='AudioRoleNum', example='2'),
  audioSegmentsEnabled?: boolean(name='AudioSegmentsEnabled', example='false'),
  labParams?: map[string]any(name='LabParams'),
  tags?: map[string]any(name='Tags'),
  transKey?: string(name='TransKey', example='trans_123'),
  transResultOssBucket?: string(name='TransResultOssBucket', example='bucket'),
  transResultOssPath?: string(name='TransResultOssPath', example='tingwu/dir/filename'),
  videoOutputEnabled?: boolean(name='VideoOutputEnabled'),
  videoOutputOssBucket?: string(name='VideoOutputOssBucket', example='bucket'),
  videoOutputOssPath?: string(name='VideoOutputOssPath', example='tingwu/dir/filename'),
}

model CreateFileTransResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    transId?: string(name='TransId', example='f7de74778d94422283534102dfc0****'),
    transKey?: string(name='TransKey', example='trans_123'),
  }(name='Data'),
  message?: string(name='Message', example='Success.'),
  requestId?: string(name='RequestId', example='35124E1C-AE99-5D6C-A52E-BD689D8D****'),
}

model CreateFileTransResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateFileTransResponseBody(name='body'),
}

async function createFileTransWithOptions(request: CreateFileTransRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateFileTransResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.abilityParams)) {
    body['AbilityParams'] = request.abilityParams;
  }
  if (!Util.isUnset(request.appKey)) {
    body['AppKey'] = request.appKey;
  }
  if (!Util.isUnset(request.asrParams)) {
    body['AsrParams'] = request.asrParams;
  }
  if (!Util.isUnset(request.audioLanguage)) {
    body['AudioLanguage'] = request.audioLanguage;
  }
  if (!Util.isUnset(request.audioOssBucket)) {
    body['AudioOssBucket'] = request.audioOssBucket;
  }
  if (!Util.isUnset(request.audioOssPath)) {
    body['AudioOssPath'] = request.audioOssPath;
  }
  if (!Util.isUnset(request.audioOutputEnabled)) {
    body['AudioOutputEnabled'] = request.audioOutputEnabled;
  }
  if (!Util.isUnset(request.audioOutputOssBucket)) {
    body['AudioOutputOssBucket'] = request.audioOutputOssBucket;
  }
  if (!Util.isUnset(request.audioOutputOssPath)) {
    body['AudioOutputOssPath'] = request.audioOutputOssPath;
  }
  if (!Util.isUnset(request.audioRoleNum)) {
    body['AudioRoleNum'] = request.audioRoleNum;
  }
  if (!Util.isUnset(request.audioSegmentsEnabled)) {
    body['AudioSegmentsEnabled'] = request.audioSegmentsEnabled;
  }
  if (!Util.isUnset(request.labParams)) {
    body['LabParams'] = request.labParams;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  if (!Util.isUnset(request.transKey)) {
    body['TransKey'] = request.transKey;
  }
  if (!Util.isUnset(request.transResultOssBucket)) {
    body['TransResultOssBucket'] = request.transResultOssBucket;
  }
  if (!Util.isUnset(request.transResultOssPath)) {
    body['TransResultOssPath'] = request.transResultOssPath;
  }
  if (!Util.isUnset(request.videoOutputEnabled)) {
    body['VideoOutputEnabled'] = request.videoOutputEnabled;
  }
  if (!Util.isUnset(request.videoOutputOssBucket)) {
    body['VideoOutputOssBucket'] = request.videoOutputOssBucket;
  }
  if (!Util.isUnset(request.videoOutputOssPath)) {
    body['VideoOutputOssPath'] = request.videoOutputOssPath;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateFileTrans',
    version = '2022-09-30',
    protocol = 'HTTPS',
    pathname = `/openapi/file-trans`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createFileTrans(request: CreateFileTransRequest): CreateFileTransResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createFileTransWithOptions(request, headers, runtime);
}

model CreateMeetingTransRequest {
  abilityParams?: map[string]any(name='AbilityParams'),
  appKey?: string(name='AppKey', example='JV1sRTisRMi****'),
  asrParams?: map[string]any(name='AsrParams'),
  audioBitRate?: int32(name='AudioBitRate', example='16'),
  audioFormat?: string(name='AudioFormat', example='pcm'),
  audioLanguage?: string(name='AudioLanguage', example='cn'),
  audioOutputEnabled?: boolean(name='AudioOutputEnabled', example='false'),
  audioOutputOssBucket?: string(name='AudioOutputOssBucket', example='bucket'),
  audioOutputOssPath?: string(name='AudioOutputOssPath', example='tingwu/dir/filename'),
  audioPackage?: string(name='AudioPackage', example='multi'),
  audioSampleRate?: int32(name='AudioSampleRate', example='16000'),
  audioSegmentsEnabled?: boolean(name='AudioSegmentsEnabled', example='false'),
  docResultEnabled?: boolean(name='DocResultEnabled', example='false'),
  labParams?: map[string]any(name='LabParams'),
  meetingKey?: string(name='MeetingKey', example='meeting_123'),
  meetingResultEnabled?: boolean(name='MeetingResultEnabled', example='false'),
  meetingResultOssBucket?: string(name='MeetingResultOssBucket', example='bucket'),
  meetingResultOssPath?: string(name='MeetingResultOssPath', example='tingwu/dir/filename'),
  realtimeActiveResultLevel?: int32(name='RealtimeActiveResultLevel', example='2'),
  realtimeResultEnabled?: boolean(name='RealtimeResultEnabled', example='true'),
  realtimeResultLevel?: int32(name='RealtimeResultLevel', example='2'),
  realtimeResultMeetingInfoEnabled?: boolean(name='RealtimeResultMeetingInfoEnabled', example='true'),
  realtimeResultWordsEnabled?: boolean(name='RealtimeResultWordsEnabled', example='true'),
  tags?: map[string]any(name='Tags'),
  translateActiveResultLevel?: int32(name='TranslateActiveResultLevel', example='2'),
  translateLanguages?: string(name='TranslateLanguages', example='cn,en'),
  translateResultEnabled?: boolean(name='TranslateResultEnabled', example='false'),
  translateResultLevel?: int32(name='TranslateResultLevel', example='2'),
}

model CreateMeetingTransResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    meetingId?: string(name='MeetingId', example='f7de74778d94422283534102dfc0****'),
    meetingJoinUrl?: string(name='MeetingJoinUrl', example='wss://tingwu-realtime-cn-beijing.aliyuncs.com/api/ws/v1?mc=****'),
    meetingKey?: string(name='MeetingKey', example='meeting_123'),
  }(name='Data'),
  message?: string(name='Message', example='Success.'),
  requestId?: string(name='RequestId', example='35124E1C-AE99-5D6C-A52E-BD689D8D****'),
}

model CreateMeetingTransResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateMeetingTransResponseBody(name='body'),
}

async function createMeetingTransWithOptions(request: CreateMeetingTransRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateMeetingTransResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.abilityParams)) {
    body['AbilityParams'] = request.abilityParams;
  }
  if (!Util.isUnset(request.appKey)) {
    body['AppKey'] = request.appKey;
  }
  if (!Util.isUnset(request.asrParams)) {
    body['AsrParams'] = request.asrParams;
  }
  if (!Util.isUnset(request.audioBitRate)) {
    body['AudioBitRate'] = request.audioBitRate;
  }
  if (!Util.isUnset(request.audioFormat)) {
    body['AudioFormat'] = request.audioFormat;
  }
  if (!Util.isUnset(request.audioLanguage)) {
    body['AudioLanguage'] = request.audioLanguage;
  }
  if (!Util.isUnset(request.audioOutputEnabled)) {
    body['AudioOutputEnabled'] = request.audioOutputEnabled;
  }
  if (!Util.isUnset(request.audioOutputOssBucket)) {
    body['AudioOutputOssBucket'] = request.audioOutputOssBucket;
  }
  if (!Util.isUnset(request.audioOutputOssPath)) {
    body['AudioOutputOssPath'] = request.audioOutputOssPath;
  }
  if (!Util.isUnset(request.audioPackage)) {
    body['AudioPackage'] = request.audioPackage;
  }
  if (!Util.isUnset(request.audioSampleRate)) {
    body['AudioSampleRate'] = request.audioSampleRate;
  }
  if (!Util.isUnset(request.audioSegmentsEnabled)) {
    body['AudioSegmentsEnabled'] = request.audioSegmentsEnabled;
  }
  if (!Util.isUnset(request.docResultEnabled)) {
    body['DocResultEnabled'] = request.docResultEnabled;
  }
  if (!Util.isUnset(request.labParams)) {
    body['LabParams'] = request.labParams;
  }
  if (!Util.isUnset(request.meetingKey)) {
    body['MeetingKey'] = request.meetingKey;
  }
  if (!Util.isUnset(request.meetingResultEnabled)) {
    body['MeetingResultEnabled'] = request.meetingResultEnabled;
  }
  if (!Util.isUnset(request.meetingResultOssBucket)) {
    body['MeetingResultOssBucket'] = request.meetingResultOssBucket;
  }
  if (!Util.isUnset(request.meetingResultOssPath)) {
    body['MeetingResultOssPath'] = request.meetingResultOssPath;
  }
  if (!Util.isUnset(request.realtimeActiveResultLevel)) {
    body['RealtimeActiveResultLevel'] = request.realtimeActiveResultLevel;
  }
  if (!Util.isUnset(request.realtimeResultEnabled)) {
    body['RealtimeResultEnabled'] = request.realtimeResultEnabled;
  }
  if (!Util.isUnset(request.realtimeResultLevel)) {
    body['RealtimeResultLevel'] = request.realtimeResultLevel;
  }
  if (!Util.isUnset(request.realtimeResultMeetingInfoEnabled)) {
    body['RealtimeResultMeetingInfoEnabled'] = request.realtimeResultMeetingInfoEnabled;
  }
  if (!Util.isUnset(request.realtimeResultWordsEnabled)) {
    body['RealtimeResultWordsEnabled'] = request.realtimeResultWordsEnabled;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  if (!Util.isUnset(request.translateActiveResultLevel)) {
    body['TranslateActiveResultLevel'] = request.translateActiveResultLevel;
  }
  if (!Util.isUnset(request.translateLanguages)) {
    body['TranslateLanguages'] = request.translateLanguages;
  }
  if (!Util.isUnset(request.translateResultEnabled)) {
    body['TranslateResultEnabled'] = request.translateResultEnabled;
  }
  if (!Util.isUnset(request.translateResultLevel)) {
    body['TranslateResultLevel'] = request.translateResultLevel;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateMeetingTrans',
    version = '2022-09-30',
    protocol = 'HTTPS',
    pathname = `/openapi/meeting-trans`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createMeetingTrans(request: CreateMeetingTransRequest): CreateMeetingTransResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createMeetingTransWithOptions(request, headers, runtime);
}

model GetFileTransResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    transId?: string(name='TransId', example='f7de74778d94422283534102dfc0****'),
    transKey?: string(name='TransKey', example='trans_123'),
    transStatus?: string(name='TransStatus', example='ONGOING'),
  }(name='Data'),
  message?: string(name='Message', example='Success.'),
  requestId?: string(name='RequestId', example='35124E1C-AE99-5D6C-A52E-BD689D8D****'),
}

model GetFileTransResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetFileTransResponseBody(name='body'),
}

async function getFileTransWithOptions(TransId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetFileTransResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetFileTrans',
    version = '2022-09-30',
    protocol = 'HTTPS',
    pathname = `/openapi/file-trans/${OpenApiUtil.getEncodeParam(TransId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFileTrans(TransId: string): GetFileTransResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getFileTransWithOptions(TransId, headers, runtime);
}

model GetMeetingTransResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    meetingId?: string(name='MeetingId', example='f7de74778d94422283534102dfc0****'),
    meetingKey?: string(name='MeetingKey', example='meeting_123'),
    meetingStatus?: string(name='MeetingStatus', example='COMPLETED'),
  }(name='Data'),
  message?: string(name='Message', example='Success.'),
  requestId?: string(name='RequestId', example='35124E1C-AE99-5D6C-A52E-BD689D8D****'),
}

model GetMeetingTransResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetMeetingTransResponseBody(name='body'),
}

async function getMeetingTransWithOptions(MeetingId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetMeetingTransResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetMeetingTrans',
    version = '2022-09-30',
    protocol = 'HTTPS',
    pathname = `/openapi/meeting-trans/${OpenApiUtil.getEncodeParam(MeetingId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getMeetingTrans(MeetingId: string): GetMeetingTransResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getMeetingTransWithOptions(MeetingId, headers, runtime);
}

model StopMeetingTransRequest {
  meetingRoleNum?: int32(name='MeetingRoleNum', example='1'),
  onlyRoleSplitResult?: boolean(name='OnlyRoleSplitResult', example='false'),
}

model StopMeetingTransResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    meetingId?: string(name='MeetingId', example='f7de74778d94422283534102dfc0****'),
    meetingKey?: string(name='MeetingKey', example='meeting_123'),
    meetingStatus?: string(name='MeetingStatus', example='PRE_COMPLETE'),
  }(name='Data'),
  message?: string(name='Message', example='Success.'),
  requestId?: string(name='RequestId', example='35124E1C-AE99-5D6C-A52E-BD689D8D****'),
}

model StopMeetingTransResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopMeetingTransResponseBody(name='body'),
}

async function stopMeetingTransWithOptions(MeetingId: string, request: StopMeetingTransRequest, headers: map[string]string, runtime: Util.RuntimeOptions): StopMeetingTransResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.meetingRoleNum)) {
    body['MeetingRoleNum'] = request.meetingRoleNum;
  }
  if (!Util.isUnset(request.onlyRoleSplitResult)) {
    body['OnlyRoleSplitResult'] = request.onlyRoleSplitResult;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StopMeetingTrans',
    version = '2022-09-30',
    protocol = 'HTTPS',
    pathname = `/openapi/meeting-trans/${OpenApiUtil.getEncodeParam(MeetingId)}/stop`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopMeetingTrans(MeetingId: string, request: StopMeetingTransRequest): StopMeetingTransResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopMeetingTransWithOptions(MeetingId, request, headers, runtime);
}

